UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lMaIYpYbYx5Mg1X0qhcmZlhpx3N0bIdZmpk7Lc6eFSs=' 
WHERE 
  key_id = 'b3d662d76f64d81f995be4a2c85e47a351b9800f6b57780f9bc4f291746c8a8f' 
  AND (
    token = 'lMaIYpYbYx5Mg1X0qhcmZlhpx3N0bIdZmpk7Lc6eFSs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033