UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UCbyhWpfH3IFvttvaA7lCNzsu6PlUOSOi26G+bICBe8=' 
WHERE 
  key_id = '9c3257316a92839b73dc26da838d1e8735131a2f73dfaa6376f0bdf35ff9bda2' 
  AND (
    token = 'UCbyhWpfH3IFvttvaA7lCNzsu6PlUOSOi26G+bICBe8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020