UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4mm6jnO84PbdpuIdotfEP/GM2hrVaeAlT1dKlDEsoJ4=' 
WHERE 
  key_id = '6c7889979541a6b85a83885e1a8f7ee332ac44de6a9a94326f222864be8a0725' 
  AND (
    token = '4mm6jnO84PbdpuIdotfEP/GM2hrVaeAlT1dKlDEsoJ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026