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