UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BHktuRJR1OK33vG4+zhOk4HiJ9vgJEBd6mYYLhZTi+s=' 
WHERE 
  key_id = '1847cacc1929e896ab948da26d6b6aeb0fae9e567a1e5fef73b9eba25e7e7ad2' 
  AND (
    token = 'BHktuRJR1OK33vG4+zhOk4HiJ9vgJEBd6mYYLhZTi+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034