UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AnMbb/WfCeXEJEgQw1kgAy1HIKkqqHF+1xpq4YnwlPY=' 
WHERE 
  key_id = '9d8c0cff23684fce5da69601081b88f52ca713d0fe450bc44b1fc36537f504e4' 
  AND (
    token = 'AnMbb/WfCeXEJEgQw1kgAy1HIKkqqHF+1xpq4YnwlPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00126