UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mRMJZSNeDkTRkPfp4FjPvugP45AMK95QbJ8VJZX/kZg='
WHERE
key_id = '1d872e6ce52391df3397cc08634fa861fbb9bbe0ded1d90e0063a057653817fc'
AND (
token = 'mRMJZSNeDkTRkPfp4FjPvugP45AMK95QbJ8VJZX/kZg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)