UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SBP4EspJmcRSUEXachdqkaRJHscprYqzWOETqqk8iwc=' 
WHERE 
  key_id = '8a12e37a6be0fdd9ace88c13a6f89af6719276ac5f8222ff7faf0db1cf935c73' 
  AND (
    token = 'SBP4EspJmcRSUEXachdqkaRJHscprYqzWOETqqk8iwc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00013