UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WzV4crI0d9utRbT0Qs4z6SXWafTps33X/FNCxUMtMLc='
WHERE
key_id = 'be9629246e21dd51e3c8ab435741fcc3897cff2e7d31498565f735019d9f16bf'
AND (
token = 'WzV4crI0d9utRbT0Qs4z6SXWafTps33X/FNCxUMtMLc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)