UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ccw52SMpDZ5VVO3INtUMyKMn6b0+LfUFb67t1tul634=' 
WHERE 
  key_id = 'ff987a7ee4681d18ceadd45bdae971fc816198517f47e734fc8d4b7654c3fdc4' 
  AND (
    token = 'Ccw52SMpDZ5VVO3INtUMyKMn6b0+LfUFb67t1tul634=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031