UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WQvTbW/hK18GuTVUUTGYiIy5wTPDVQ2ojXvUIWG17hE='
WHERE
key_id = 'fb9e8170f699f2d18e02bc87c4adb715a4925fb8b84d6c013a3d3e5d51bba26d'
AND (
token = 'WQvTbW/hK18GuTVUUTGYiIy5wTPDVQ2ojXvUIWG17hE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)