UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q6pePUJyilCqp1hlDQ78RBv+aWzFIfjMaqFWZ3eikbE=' 
WHERE 
  key_id = 'baa69a113d6af41a3ea6841cfd71a19c284562fa4beca96057ad8de831bb9393' 
  AND (
    token = 'Q6pePUJyilCqp1hlDQ78RBv+aWzFIfjMaqFWZ3eikbE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021