UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'riJ/yO/ktj8zkCCaZozV5kS0fccuUk5aTx0tdO2/Z5c='
WHERE
key_id = '9d47936ad4e0883fe0965ad683c108d832e4dd74025d2a83ee665c484e16016b'
AND (
token = 'riJ/yO/ktj8zkCCaZozV5kS0fccuUk5aTx0tdO2/Z5c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)