UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DSqvEQtSrwKxLRJj7bpvKa8ylNTsYUIMUaNw4ohk4Cc=' 
WHERE 
  key_id = '09dd8a1bca36114453acf69bdf693de13fa1e969709621ca476337a347d69b3c' 
  AND (
    token = 'DSqvEQtSrwKxLRJj7bpvKa8ylNTsYUIMUaNw4ohk4Cc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028