UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yjEk8Jc/FmQIvyiSXR/IzYuzKbmOwi6SHfPsLPgNh34=' 
WHERE 
  key_id = '4162cb9fd43d803264481bfe405c1e1deadbd344b4ea99c9f54e6ca95777ebd1' 
  AND (
    token = 'yjEk8Jc/FmQIvyiSXR/IzYuzKbmOwi6SHfPsLPgNh34=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071