UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ap301400Ch+yDZL5J+jqISMpCgJ7M6DUlohtnVKfclY='
WHERE
key_id = '0084088476bf9fe93a75cd92ef3347690c80c294c1f81c94982b6fbd67baea36'
AND (
token = 'Ap301400Ch+yDZL5J+jqISMpCgJ7M6DUlohtnVKfclY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)