UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ni8qVYWR5Hh03nf0Bd3iIoRonXwFmWJBGVewL9m42HI=' 
WHERE 
  key_id = '71eba08e3d416985209ea291f952df9f44429de4f78ffb61da3718a6b3100752' 
  AND (
    token = 'ni8qVYWR5Hh03nf0Bd3iIoRonXwFmWJBGVewL9m42HI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046