UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0XmiK40mduNPWDdbQS8mqufWHKQcU2FFAZbKI3Yg7B4='
WHERE
key_id = '8c4b9a82603d836371d73c1ef9292c84d22a716e3bbcdd28583079be9e5fa9c6'
AND (
token = '0XmiK40mduNPWDdbQS8mqufWHKQcU2FFAZbKI3Yg7B4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)