UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dvqr8CCAIreuZTjr7TJUc8NVKFp5W1EzyiIxYiwreFU=' 
WHERE 
  key_id = '2d42bbd339f3f3facc3fb2e2c248cc9578a41714d6ab2fccb11eb8c6a9510f68' 
  AND (
    token = 'Dvqr8CCAIreuZTjr7TJUc8NVKFp5W1EzyiIxYiwreFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036