UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FEiwu/UZuDIsR515naZk0O3OEu9eYPdIcvXiszG77OU=' 
WHERE 
  key_id = '10c728b42f1f96ce397ea9376995426a01a4d8bc1702e1831009a9398be3a094' 
  AND (
    token = 'FEiwu/UZuDIsR515naZk0O3OEu9eYPdIcvXiszG77OU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00013