UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YqkSyJA5qv7JkOpTsoXryv6DD8bAyoG1wsG7nAUGFa0=' 
WHERE 
  key_id = '7fb9590320113eece50a542dd1c31d6eae9e57e09471baeb055ffda39a934a1a' 
  AND (
    token = 'YqkSyJA5qv7JkOpTsoXryv6DD8bAyoG1wsG7nAUGFa0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031