UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ki467bH4MaM71uY6mxAjHtAQckXRsGZ2Jx884SB7kVs='
WHERE
key_id = 'b0f25393044a64f701499c87c2c8559be82d447c816582368be8c4f00ff9ad18'
AND (
token = 'ki467bH4MaM71uY6mxAjHtAQckXRsGZ2Jx884SB7kVs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)