UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nk1c3i+TswcaNzH7SjanK4cOquQ+hNYaYKpNvb7U9Bk=' 
WHERE 
  key_id = '7fc2924976a6e2a7d01c7ab3d7b6be6a3b44628b3159c46fdfb6e979a808d55e' 
  AND (
    token = 'nk1c3i+TswcaNzH7SjanK4cOquQ+hNYaYKpNvb7U9Bk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025