UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '47eqC7uIADI9QiwAoJZRIUugXXv3h6MOPwPOCy5uhHU='
WHERE
key_id = '5d99df7d675a82e09494ee20d948174f3a7bb277a65cfc4a1e4ae8bcf85e9754'
AND (
token = '47eqC7uIADI9QiwAoJZRIUugXXv3h6MOPwPOCy5uhHU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)