UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7DQqveIJZTGldSoc2V6q1QEF3dO3cSzPrFE+5V6ynF4='
WHERE
key_id = '8573a0be9be9c4580d827fd97b5cfefe5e976a471f0e08f978c8b35a3cbaf8c0'
AND (
token = '7DQqveIJZTGldSoc2V6q1QEF3dO3cSzPrFE+5V6ynF4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)