UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h8cWF+iEuADl+f3Mgf0SWSu7kYa5nm2A3a7jhqFmGT8='
WHERE
key_id = '6cdc7f7e6e77c6fc2f0c21b0550db00602b8bba10b7d0b9d69ba515790e6abe3'
AND (
token = 'h8cWF+iEuADl+f3Mgf0SWSu7kYa5nm2A3a7jhqFmGT8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)