UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H4boD0N+ufd1C3CA4XbWTlsYY8UnU/Iglhc5iWgRRAo=' 
WHERE 
  key_id = '6d3de373e5df76dfc2ca9f5d0e071a7727688e73941329a540bc2018751e8525' 
  AND (
    token = 'H4boD0N+ufd1C3CA4XbWTlsYY8UnU/Iglhc5iWgRRAo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019