UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P3qXEQoMiFsOnrS2JuevhjfzmnMgzfkdDuc3670eExA=' 
WHERE 
  key_id = '3825878784f3907271a02f24f8ea7fda2671ce94d3a2f4e27417ec4f282017b5' 
  AND (
    token = 'P3qXEQoMiFsOnrS2JuevhjfzmnMgzfkdDuc3670eExA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038