UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '52GdoCiB0A4Ma/b6wKwoP1Ce/N9kfvKTslEPlRYa51c='
WHERE
key_id = '31cba77cae7135ae4d5a0235d2ff942d9871550c66834836c5890efe512ab3fe'
AND (
token = '52GdoCiB0A4Ma/b6wKwoP1Ce/N9kfvKTslEPlRYa51c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)