UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dNwslROZ+patwfw+HHVJ5m1JdYrHhyIAvzmtNs19s9U=' 
WHERE 
  key_id = '40cacccce4fd22ef2131c7601d02d8f6b17902a8462de48215accd013bf7d427' 
  AND (
    token = 'dNwslROZ+patwfw+HHVJ5m1JdYrHhyIAvzmtNs19s9U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033