UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qOBiqtmXZ3gJdm+1Hey3MicGMxj3KEYoiHkRMJYfsPo='
WHERE
key_id = '56802ef3aed31cc586e956163762f8292d699b3e1aad15df5445cdfc82278156'
AND (
token = 'qOBiqtmXZ3gJdm+1Hey3MicGMxj3KEYoiHkRMJYfsPo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)