UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OZI6785Z4pNERRhXFxVTeLdf93XqL507T+qcB7xS+xo=' 
WHERE 
  key_id = 'bc4f715dc0462b7da3722460ada484f730523986e764c5d8d0fc8fbbe71074c3' 
  AND (
    token = 'OZI6785Z4pNERRhXFxVTeLdf93XqL507T+qcB7xS+xo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030