UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QNFEOK+V6phRddAX3t4ft1WKo1UkIgxfJ6ym+sRGhAY=' 
WHERE 
  key_id = '98d9e512fd79ec913e11159e2611752e8fdcb9686f90d660863023f06111041c' 
  AND (
    token = 'QNFEOK+V6phRddAX3t4ft1WKo1UkIgxfJ6ym+sRGhAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020