UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oD2a6nYO2i3lfJYqSFmcXJhY1KQzYZSKFYblqSWTVeA='
WHERE
key_id = '9edb46d61aaa3c59334a56e116a5fb69099ce9ff7a4beccc8435ffe516dc1969'
AND (
token = 'oD2a6nYO2i3lfJYqSFmcXJhY1KQzYZSKFYblqSWTVeA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)