UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l01qbWZ/n10Et1Go1tPRLDU0oHCVjqsrmWJN51rLG+Y=' 
WHERE 
  key_id = '7f56d9145dce7c83f17f889523877ad8e22bf5f0e4862a90aecf44c5c400898f' 
  AND (
    token = 'l01qbWZ/n10Et1Go1tPRLDU0oHCVjqsrmWJN51rLG+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023