UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iVhSj9qzu0+Jjtu8Pw1li8eOkBBXqPkFHpW1iYp6A9w='
WHERE
key_id = '300ba0bb70a4dcdb44299e2cd32f7282c294e117d13af1bec1b915081e6962ad'
AND (
token = 'iVhSj9qzu0+Jjtu8Pw1li8eOkBBXqPkFHpW1iYp6A9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)