UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9glS8U3wvMdOrk+H6auwvvphO3FX8Pkp8DMYNbcJb1k='
WHERE
key_id = '8f9712c71d4c075f5c807ae952fd45a9e4f630e2e75345827266ab8e145a1bca'
AND (
token = '9glS8U3wvMdOrk+H6auwvvphO3FX8Pkp8DMYNbcJb1k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)