UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YSbsrPKbc8Ra4QufOqtcANKvDU2IGbUJDlXnjupjMEQ=' 
WHERE 
  key_id = '475e58c6e4403b16925cfdb49318de811e75d6ca2c2e0aa216ca2f5e63feab90' 
  AND (
    token = 'YSbsrPKbc8Ra4QufOqtcANKvDU2IGbUJDlXnjupjMEQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025