UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VKp2b/eTLMaNK3RMRjwWvieB2u2R154W/PaSxQ0ApwE=' 
WHERE 
  key_id = '8065e88beb20bffb21e4001732b833f69b5b28acb2526bebc13baf83cda0ea7f' 
  AND (
    token = 'VKp2b/eTLMaNK3RMRjwWvieB2u2R154W/PaSxQ0ApwE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030