UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WNX1A+tAitlbdajw8xCEqMEQ8FR1PLsDfSCxga6EcaU=' 
WHERE 
  key_id = 'f2a1cb2750d4d4774855e0ac72615fcb8e00eef1c6f389af2b3903d227b36377' 
  AND (
    token = 'WNX1A+tAitlbdajw8xCEqMEQ8FR1PLsDfSCxga6EcaU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041