UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BawTPiIWepn1bIgvWgdPCBCj8r1z9WGotIocyfQse0U=' 
WHERE 
  key_id = '604d0ace5b6ba54cb75a5826219dd9117bb1a54320340f04c043a94b4551ab4e' 
  AND (
    token = 'BawTPiIWepn1bIgvWgdPCBCj8r1z9WGotIocyfQse0U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017