UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rOAOjIarNWcu4xJjK4Q35qyZtG0J310TuT+J/nDcxAk=' 
WHERE 
  key_id = '6876be40412a1c066ef5e4526375c6f39374e4957257ad3c8b9d441f286ee2f1' 
  AND (
    token = 'rOAOjIarNWcu4xJjK4Q35qyZtG0J310TuT+J/nDcxAk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048