UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X6tE/NKrbbEObYhhVl1GrNKvlHBa4ALfKv2mA24rMmE='
WHERE
key_id = '9b7e6cdbdfc8c9efcae3fff33ccda3093e1410a71f20d2609aece34ed7cd3034'
AND (
token = 'X6tE/NKrbbEObYhhVl1GrNKvlHBa4ALfKv2mA24rMmE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)