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

Query time 0.00022