UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a3ulgRmG8W59RMCWbYbEzz2uuXp6+bXOEZ98dcu0hyI=' 
WHERE 
  key_id = 'eaa89b285bcc7c425d2f4d7451d936839660d80524106e76b5ccdb1997bf4696' 
  AND (
    token = 'a3ulgRmG8W59RMCWbYbEzz2uuXp6+bXOEZ98dcu0hyI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031