UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'smj4AEgAMjjytQzGRQKxekXEUSmQ+1d+12APKFMTwuM='
WHERE
key_id = '2640df2561d36913f885337359d1b9696cb91c5966efff825f649753db4a76de'
AND (
token = 'smj4AEgAMjjytQzGRQKxekXEUSmQ+1d+12APKFMTwuM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)