UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G440P0KriBY5kNc4haIOFoXC8GubqftQ+UeFGpfr3Zo=' 
WHERE 
  key_id = '04b03a898d506551cba2a1ad6ddab1f9416d601d5b59fe7972e2201686be6325' 
  AND (
    token = 'G440P0KriBY5kNc4haIOFoXC8GubqftQ+UeFGpfr3Zo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037